* This file should be used with the data in "Stuck_in_the_Middle_data.dta".
* It includes the model presented in Figure 1.

clear all
use "Stuck_in_the_Middle_data.dta"
set more off

log using "Stuck_in_the_Middle_robustness_log", replace


* Table A5: Main-Text models:
* Pooled model:
clogit cvote dis_lr i.party, group(resp_id) or
* Country-year models
forvalue i=1(1)12 {
clogit cvote dis_lr i.party if cyear==`i', group(resp_id) or
}

* Table A6: Models from the main text with controls:
set more off
recode age (min/45=0) (45/65=1) (65/max=2)
* Pooled model:
clogit cvote dis_lr i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union, group(resp_id) or
* Country-year models
forvalue i=1(1)12 {
clogit cvote dis_lr i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union if cyear==`i', group(resp_id) or
}

* Table A7: Both Linear and Quadratic Proximity (Excluding Controls):
set more off
* Pooled model:
clogit cvote dis_lr s_dis_lr i.party, group(resp_id) or
* Country Models
forvalue i=1(1)12 {
clogit cvote dis_lr s_dis_lr i.party if cyear==`i', group(resp_id) or
}

* Table A8: Both Linear and Quadratic Proximity (Including Controls)
set more off
* Pooled model:
clogit cvote dis_lr s_dis_lr i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union, group(resp_id) or
* Country-year models
forvalue i=1(1)12 {
clogit cvote dis_lr s_dis_lr i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union if cyear==`i', group(resp_id) or
}

* Table A9: Linear Multi-Dimensional Models:
set more off
* Pooled model:
clogit cvote dis_lr dis_tax dis_imm dis_cc i.party if cyear==4, group(resp_id) or

clogit cvote dis_lr dis_tax dis_imm dis_cc i.party if cyear==5, group(resp_id) or

clogit cvote dis_lr dis_tax dis_imm dis_cc i.party if cyear==6, group(resp_id) or

clogit cvote dis_lr dis_imm i.party if cyear==11, group(resp_id) or

clogit cvote dis_lr dis_tax dis_eu i.party if cyear==8, group(resp_id) or

clogit cvote dis_lr dis_tax dis_eu i.party if cyear==9, group(resp_id) or

* Table A10: Adding a directional component:
set more off
gen direction = 0 if resp_selfplace==5
replace direction = 1 if resp_selfplace<5 & mean_all<5
replace direction = 1 if resp_selfplace>5 & mean_all>5
replace direction = -1 if resp_selfplace>5 & mean_all<5
replace direction = -1 if resp_selfplace<5 & mean_all>5
* Pooled model:
clogit cvote dis_lr direction i.party, group(resp_id) or
* Country Models
forvalue i=1(1)12 {
clogit cvote dis_lr direction i.party if cyear==`i', group(resp_id) or
}

* Table A11: Directional component, controls, and squared proximity:
set more off
* Pooled model:
clogit cvote dis_lr s_dis_lr direction i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union, group(resp_id) or
* Country Models
forvalue i=1(1)12 {
clogit cvote dis_lr s_dis_lr direction i.party##i.age i.party##i.econ i.party##i.edu i.party##i.female i.party##i.know i.party##i.union if cyear==`i', group(resp_id) or
}
* leader thermometer score:
* Pooled model:
clogit cvote dis_lr i.party resplike_l, group(resp_id) or
* Country-year models
forvalue i=1(1)12 {
clogit cvote dis_lr i.party resplike_l if cyear==`i', group(resp_id) or
}


log close
